﻿var MobileCom = new Object();
MobileCom.getQueryString = function (name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}
MobileCom.GetUserCode = function (callback) {
    var Code = MobileCom.getQueryString("code");
    $.get('/View/Comon/ComBaseAPI.ashx?Action=GetUserCodeByCode&code=' + Code, function (UserCode) {
        if (UserCode=="") {
            window.location.href = "Msg.html";
        } else {
            $("#hidUserCode").val(UserCode);
            return callback.call(this, UserCode);
        }
    })
}
MobileCom.AlertMsg = function (content) {
    layer.open({
        content: content,
        btn: ['确认']
    });
}
MobileCom.getnowdate = function (format) {
    var now = new Date();

    var year = now.getFullYear();       //年
    var month = now.getMonth() + 1;     //月
    var day = now.getDate();            //日
    var clock = year + "-";

    if (format == "yyyy-mm") {
        if (month < 10)
            clock += "0";
        clock += month + "-";
    }

    if (format == "yyyy-mm-dd") {
        if (month < 10)
            clock += "0";
        clock += month + "-";
        if (day < 10) {
            clock += "0";
        }
        clock += day + "-";
    }
    return (clock.substr(0, clock.length - 1));

}

